home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 1.3 KB | 65 lines | [TEXT/MSET] |
- (*
- Clipboard menu handlers for our standard selection environment. We only
- implemet text data, but of course we could generalize to pict data if we
- wish.
- *)
-
-
- : todesk ( -- oserr )
- 0 call ZeroScrap IF exit THEN \ out if error
- 0 \ room for oserr
- global TEScrpLength w@ \ length
- 'type TEXT \ theType
- global TEScrpHandle @ @
- call PutScrap
- ;
-
- variable offset \ used in GetScrap call
-
- : fromdesk ( -- oserr )
- 0 \ room for result
- global TEScrpHandle @
- 'type TEXT \ theType
- offset
- call GetScrap
- dup 0>= IF global TEScrpLength w! \ store scrap length
- false \ no error
- THEN
- ;
-
- \ we hope that the actW knows about our standard clipboard messages:
- : selcut
- actW IF cut: actW THEN ;
-
- : selcopy
- actW IF copy: actW THEN ;
-
- : selpaste
- actW IF paste: actW THEN ;
-
- : selclear
- actW IF clear: actW THEN ;
-
- ' selcut ' xCut (patch)
- ' selcopy ' xCopy (patch)
- ' selpaste ' xPaste (patch)
- ' selclear ' xClear (patch)
-
- endload
-
- *** EXAMPLE USE
-
- \ here is how we would set up the menu in an application, but this won't
- \ work for the Mops front end because Mops will setup its own menu
- \ handlers *after* init_actions is executed. So we resorted to (patch), see above
- \ just for the development environment.
-
- : initclip
- xts{ xUndo null selcut selcopy selpaste selclear xSelAll null doPref }
- 3 init: EditMen
- ;
-
- \ ' initclip add: init_actions
-
-
-